class Stack:
    def __init__(self):
        self.data = [0] * 10000
        self.top = -1

    def push(self, e):
        self.top += 1
        self.data[self.top] = e

    def pop(self):
        self.top -= 1

    def top(self):
        return self.data[self.top + 1]

    def __str__(self):
        return str(self.data[:self.top + 1])

    def empty(self):
        return self.top < 0


S = Stack()
for i in range(10):
    S.push(i)
while not S.empty():
    print(S)
    S.pop()
